'
please show code
Write CREATE TABLE
and ALTER TABLE
statements that:
phone
table.has
relationships as foreign keys in the Sakila customer
, staff
, and store
tables.phone
column from the Sakila address
table.Step 2 requires adding a foreign key constraint to an existing table. Example:\r\n\r\n\r\nALTER TABLE customer\r\nADD FOREIGN KEY (phone_id) REFERENCES phone(phone_id)\r\nON DELETE SET NULL\r\nON UPDATE CASCADE;
Specify data types as follows:
phone_id
, phone_number
, and country_code
have data type INT
.phone_type
has data type VARCHAR(12)
and contains strings like \'Home\', \'Mobile\', and \'Other\'.Apply these constraints:
NOT NULL
constraints correspond to coordinates on the diagram above.SET NULL
for delete rules and CASCADE
for update rules.\r\n\r\n\r\n\r\n\r\n\r\n